export default {
    bind(element, binding, vnode) {
        function handler(e) {
            if (element.contains(e.target)) {
                return false
            }
            if (binding.expression) {
                binding.value(e)
            }
        }

        element.__vueClickOutside__ = handler
        document.addEventListener('click', handler)
    },
    update() {

    },
    unbind(element, binding) {
        document.removeEventListener('click', element.__vueClickOutside__)
        delete element.__vueClickOutside__
    },
}
